Skip to content

fix(template): ship a src-layout starter package and smoke test - #37

Merged
Andreas-Garcia merged 1 commit into
mainfrom
fix/template-starter-no-tests-flat-layout
Dec 2, 2026
Merged

Andreas-Garcia merged 1 commit into
mainfrom
fix/template-starter-no-tests-flat-layout

Conversation

@Andreas-Garcia

Copy link
Copy Markdown
Member

Summary

A fresh render failed scripts/check.sh (pytest exit 5, no tests) and the starter [build-system] could not build a flat-layout package. The template now declares a src layout and copier copy creates a starter package and smoke test.

Issues

Refs #33

Changes

  • template/pyproject.toml.jinja: [tool.setuptools.packages.find] where = ["src"].
  • copier.yml: a _tasks entry gated on _copier_operation == 'copy' (skipped when the repo already has a Python package, so --overwrite adoption keeps its layout) creates src/<module>/__init__.py, py.typed and tests/test_import.py when missing. Template files were rejected because copier update would add them to existing consumers. package_module is a derived when: false question; package_name gets a validator (leading letter or underscore, not a Python keyword).
  • copier copy now needs --trust (tasks); docs, README, AGENTS.md validate command and scripts/tests/agent-template.sh updated.

Test plan

  • Render package_name=My-Pkg with --trust, uv lock, bash scripts/check.sh: passes (1 test).
  • Render from v6.0.0, then copier update --trust to this commit: no src/ or tests/ added.
  • bash scripts/tests/agent-template.sh <check-project-agents.py>: passes.

Screenshots

N/A

Risk

Intent change, depth standard: localized template behavior with understood contracts. copier copy now requires --trust; copier update is unaffected for existing consumers.

How to revert

Revert the squash commit.

Deployment notes

Merging a fix: PR makes Release Please publish a patch release (v6.0.1 expected).

Post-deploy verification

N/A

🤖 Generated with Claude Code

A fresh render failed scripts/check.sh (pytest exit 5, no tests) and the
starter build-system could not build a flat-layout package. Declare
[tool.setuptools.packages.find] where = ["src"] and create the starter
src package, py.typed and tests/test_import.py from a copy-only _tasks
entry, so `copier update` never adds them to existing consumers. The
copy now needs --trust; package_name is validated to start with a letter
or underscore.

Refs #33

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Andreas-Garcia
Andreas-Garcia enabled auto-merge (squash) December 2, 2026 19:54
@Andreas-Garcia
Andreas-Garcia merged commit 6c32598 into main Dec 2, 2026
9 checks passed
@Andreas-Garcia
Andreas-Garcia deleted the fix/template-starter-no-tests-flat-layout branch December 2, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant